﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Surface;
using Microsoft.Surface.Core;

namespace Sublimation
{
    class Player_Surf: Player{
        WorldProperties_Surf worldProperties;
        public Player_Surf(Game game, WorldProperties_Surf worldProperties)
            : base(game)
        {
            this.worldProperties = worldProperties;
            // the play starts with one tower
            Towers.Add(new Tower_Surf(game, this, new Vector2(100, 100), worldProperties));
            Towers.Add(new Tower_Surf(game, this, new Vector2(300, 300), worldProperties));
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            foreach (Contact contact in worldProperties.Contacts)
            {
                if (worldProperties.Owned.Contains(contact.Id))
                {
                    continue;
                }
                foreach (Tower_Surf tower in towers)
                {
                    if (contact.IsFingerRecognized && tower.belongs(contact))
                    {
                        tower.add_contact(contact);
                        worldProperties.Owned.Add(contact.Id);
                        break;
                    }
                }
            }
        }
    }
}
